package com.changgou;

import com.changgou.interceptor.FeignInterceptor;
import com.changgou.order.config.TokenDecode;
import com.changgou.util.IdWorker;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;
@EnableScheduling //开启定时任务
@SpringBootApplication
@EnableEurekaClient
@MapperScan(basePackages = {"com.changgou.order.dao"})
@EnableFeignClients(basePackages = {"com.changgou.goods.feign","com.changgou.user.feign","com.changgou.pay.feign"})//开启feign的调用

public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run( OrderApplication.class);
    }

@Bean
    public TokenDecode tokenDecode(){
        return new TokenDecode();
}


@Bean
    public IdWorker idWorker(){
        return new IdWorker(1,1);
}

@Bean
    //声明Feign的拦截器

    public FeignInterceptor feignInterceptor(){

        return new FeignInterceptor();
}


}
